# Build
FROM golang:1.11-alpine AS builder
ARG gitCommit
ARG buildTime

ADD ./ /go/src/gitee.com/iexception007/drone_go/
WORKDIR /go/src/gitee.com/iexception007/drone_go/
RUN go build -ldflags "-X 'main.gitCommit=${gitCommit}' -X 'main.buildTime=${buildTime}'" && \
    mv ./drone_go /usr/bin/drone_go

# Main
FROM alpine:3.8
COPY --from=builder /usr/bin/drone_go /usr/local/bin/drone_go
ENTRYPOINT [ "/usr/local/bin/drone_go" ]